package com.jsp.controller; /**
 * @author wzm
 * @create 2023-11-09 10:32
 * project_name:web2310
 * @Description
 */

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;

@WebServlet("/test")
public class TestServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {


        //当访问当前servlet时跳转到index.jsp
        System.out.println("test执行了");
        //请求转发
        request.getRequestDispatcher("/index.jsp").forward(request, response);
        //重定向
        //response.sendRedirect("/index.jsp");


    }
}

